package com.xique.door.controller;


import com.xique.door.bean.domain.User;
import com.xique.door.service.IUserService;
import com.xique.door.service.IVisitorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * @Auther: caogq
 * @Date: 2021/7/8 14:37
 * @Description:
 */
@Controller
@RequestMapping("/oms/user/visitor")
public class UserVisitorController {

    private String prefix = "oms/user";

    @Autowired
    IUserService userService;

    @Autowired
    IVisitorService visitorService;

    @GetMapping("/add/{parkId}")
    public String add(@PathVariable("parkId") Long parkId, ModelMap mmap, HttpServletRequest request)
    {
        String userId = request.getParameter("userId");
        mmap.put("parkId",parkId);
        mmap.put("userId",userId);
        User user = userService.selectUserById(Long.valueOf(userId));
        mmap.put("userName",user.getUserName());
        return prefix + "/addVisitor";
    }

}
